<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
<div id="app">
    <ul>
        <!-- 不规范的写法 -->
        <!-- <li v-for="item in arr" :key="item.title" v-if="item.flag">{{item.title}}</li> -->
        <template v-for="item in arr" :key="item.title">
            <li v-if="item.flag">{{item.title}}</li>
        </template>
    </ul>
</div>
</body>

</html>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
    //vue3中的优先级,v-if的优先级比v-for的优先级要高

    let app = Vue.createApp({
        data() {
            return {
                arr: [
                    {
                        flag: true,
                        title: 'ps5 '
                    },
                    {
                        flag: false,
                        title: 'switch'
                    },
                    {
                        flag: true,
                        title: "psp"
                    }
                ]
            }
        }
    })

    app.mount('#app')
</script>